﻿using ArtMath.Attribute;
using ArtMath.Data;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace ArtMath.Component.Line
{
    /// <summary>
    /// 泰勒公式
    /// </summary>
    [Serializable]
    public class TaylorFormula : Function
    {
        Function oriFunc;
        int highestPower;
        public TaylorFormula(SketchPad pad, string name, Function func, int highestPower, bool addToList = true) : base(pad, name, ToolTypeName.tlgs, null, null, addToList)
        {
            OriginalFunction = func;
            HighestPower = highestPower;
        }
        [Browsable(false)]
        public override string IndependentVariable
        {
            get
            {
                return base.IndependentVariable;
            }

            set
            {
                base.IndependentVariable = value;
            }
        }
        [MultilingualCategory("Parameter"), ReadOnly(true)]
        public override ManualParameterStringX FunctionExpression
        {
            get
            {
                return base.FunctionExpression;
            }

            set
            {
                base.FunctionExpression = value;
            }
        }
        [MultilingualCategory("Structure"), MultilingualDisplayName("PrimitiveFunction"), TypeConverter(typeof(ExpandableObjectConverter))]
        public Function OriginalFunction
        {
            get { return oriFunc; }
            set
            {
                oriFunc?.OutChildren_Line.Remove(this);
                oriFunc = value;
                oriFunc?.OutChildren_Line.Add(this);
            }
        }
        public int HighestPower
        {
            get { return highestPower; }
            set
            {
                if (value < 0)
                {

                }
                else
                {
                    highestPower = value;

                }
            }
        }
    }
}
